package com.briup.sxau.util;


import lombok.Data;

/**
 *
 * @param <T> 返回数据的类型参数
 *          统一响应实体设计
 */
@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;

    public static<T> Result success(T data){
        Result result = new Result();
        result.setCode(200);
        result.setMsg("ok");
        result.setData(data);
        return result;
    }
    public static <T> Result success(){
        Result result = new Result();
        result.setCode(200);
        result.setMsg("ok");
        return result;
    }
    public  static  <T> Result error(int code,String msg){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}